package com.wuba.rxjavademo.lyz.day0429;

import com.wuba.rxjavademo.lyz.BaseDemo;

import rx.Observable;
import rx.subjects.PublishSubject;

/**
 * Created by liyaxing on 2016/5/19.
 */
public class Demo04 extends BaseDemo {

    public static void main(String[] ss){

        Observable<Integer> originObservable = Observable.just(1,2,3,4,5) ;
        PublishSubject<Integer> subject = PublishSubject.create() ;

        subject.subscribe(integer -> print(integer)) ;

        subject.onNext(111);
        subject.onCompleted();
        subject.subscribe(integer -> print(integer)) ;
        subject.onNext(222);
        subject.onNext(333);
        try {
            Thread.sleep(50000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }


}
